/***************************************************************************
 *   mgpi.c - Additional Definitions                                       *
 *   Copyright (C) 2008 by cmaster.matso                                   *
 *   cmaster.matso@gmail.com                                               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include "mgpi.h"

//#ifndef WIN32
//static void __sig_ill_(int sig) {
//    MGPI_PostMessagef("%s: illegel operation: sig = %d", __FUN__, sig);
//    exit(EXIT_FAILURE);
//}
//
//static void __sig_int_(int sig) {
//    MGPI_PostMessagef("%s: interrupt captured: sig = %d", __FUN__, sig);
//    exit(EXIT_FAILURE);
//}
//
//static void __sig_segv_(int sig) {
//    MGPI_PostMessagef("%s: memory segment violation: sig = %d", __FUN__, sig);
//    exit(EXIT_FAILURE);
//}
//
//static void __sig_fpe_(int sig) {
//    MGPI_PostMessagef("%s: illegal arythmetic operation: sig = %d", __FUN__, sig);
//    exit(EXIT_FAILURE);
//}
//#endif

/**
 * Routine called at the end of any MGPF using application.
 */
void MGPI_Exit(void) {
    fprintf(stdout, "grbclr: removed data: %d\n", MGPI_RemoveGarbage());
    MGPI_GetMessages(stdout);
//#ifndef WIN32
//    signal(SIGILL, SIG_DFL);
//    signal(SIGINT, SIG_DFL);
//    signal(SIGSEGV, SIG_DFL);
//    signal(SIGFPE, SIG_DFL);
//#endif
    return;
}

/**
 * Starts the framework.
 */
void MGPI_Init(void) {
//#ifndef WIN32
//    signal(SIGILL, __sig_ill_);
//    signal(SIGINT, __sig_int_);
//    signal(SIGSEGV, __sig_segv_);
//    signal(SIGFPE, __sig_fpe_);
//#endif
    return;
}
